import request from "@/utils/request";

//获取所有角色列表
export const  getAllRolesList=(data)=>{
    return request({
        method: 'post',
        url: 'api/x-roles/select_xroles_pages',
        data: data
    })
}

//获取单个角色列表
export const  getOneRoles=(data)=>{
    return request({
        method: 'post',
        url: 'api/x-roles/get_one_roles',
        data: data
    })
}

//新增角色
export const  AddRoles=(data)=>{
    return request({
        method: 'post',
        url: 'api/x-roles/add_roles',
        data: data
    })
}


//修改角色列表
export const  UpdateRoles=(data)=>{
    return request({
        method: 'put',
        url: 'api/x-roles/update_roles',
        data: data
    })
}

//删除单个角色列表
export const  RemoveRoles=(roleId)=>{
    return request({
        method: 'delete',
        url: `api/x-roles/delete_role/${roleId}`
    })
}

//获取角色拥有的菜单信息
export const  gainRoleMenus=(roleId)=>{
    return request({
        method: 'get',
        url: `api/x-menu-role/select_menu_roles/${roleId}`,
        params:{
            roleId:roleId
        }
    })
}

//给角色分配对应的菜单项
export  const setRoleMenus=(data)=>{
    return request({
        method: 'post',
        url: 'api/x-menu-role/distribute_menu',
        data: data
    })
}

//给角色分配对应的资源
export  const setRoleSource=(data)=>{
    return request({
        method: 'post',
        url: 'api/x-menu-role/distribute_limit',
        data: data
    })
}

//查询所有角色列表,并且是属于当前用户的
export const  getWorkRolesSelect=(data)=>{
    return request({
        method: 'post',
        url: 'api/x-roles/select_xroles_select',
        data:data
    })
}

